package org.concepts.java.classloader.utils;

public class ClassLoaderUtils {

  /**
   * Print all the parent classloader's till we get null.
   * 
   * @param classloader
   *          classloader. Can be null.
   */
  public static void printParentCLs(ClassLoader classloader) {
  
    if (classloader == null) {
      return;
    }
  
    ClassLoader currentCL = classloader;
    ClassLoader parentCL = currentCL.getParent();
    while (parentCL != null) {
      System.out.println("Parent CL [" + parentCL + "] Current CL ["
          + currentCL + "]");
      currentCL = parentCL;
      parentCL = currentCL.getParent();
    }
  }

}
